home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / serial / callback.001 / callback~ / callback / lib / dbase / updatecbstate.c < prev    next >
C/C++ Source or Header  |  1996-07-22  |  911b  |  37 lines

  1.  
  2. #include "dbase.p"
  3.  
  4. void update_cbstate(char *line)
  5. {
  6.     int
  7.         state;
  8.     unsigned
  9.         userid;
  10.         
  11.     switch (getstate(&state, &userid))
  12.     {
  13.         case -2:    /* expiry */
  14.             log(log_on, "Callback expiry on line %s after %u seconds",
  15.                      line, maxage);
  16.              enable_state();
  17.         break;                         
  18.                
  19.         case -1:    /* absent file */
  20.             log(log_on, "Callback standby on line %s",
  21.                      line);
  22.         break;
  23.  
  24.         case 0:     /* states exhausted */
  25.             log(log_on, "Callback states on line %s exhausted: reenabling", 
  26.                 line);
  27.             enable_state();
  28.         break; 
  29.         
  30.         default:
  31.             log(log_on, "Callback state on line %s : %d for %s", 
  32.                      line, state, username(userid));
  33.             state--;
  34.             writestate(state, userid);
  35.     }
  36. }
  37.